﻿#pragma once

#include "../MonsterObject.h"
#include "../../MirDatabase/MonsterInfo.h"
#include "../MapObject.h"
#include "../../../Shared/Enums.h"
#include "../PlayerObject.h"
#include "../../../Shared/Packet.h"
#include "../../../stringhelper.h"

using namespace Server::MirDatabase;
namespace S = ServerPackets;

namespace Server::MirObjects::Monsters
{
    class TrapRock : public MonsterObject
    {
    public:
        bool Visible = false, ChildRock = false, FirstAttack = false;
        long long VisibleTime = 0;
        unsigned char SpawnCorner = 0;
        TrapRock *ParentRock;
        Point *TargetLocation;

        virtual ~TrapRock()
        {
            delete ParentRock;
            delete TargetLocation;
        }

    protected:
        bool getCanAttack() const override;
        bool getCanMove() const override;
    public:
        bool getBlocking() const override;

    protected:
        TrapRock(MonsterInfo *info);

    public:
        MapObject *getTarget() const override;
        void setTarget(MapObject *value) override;


    protected:
        void ProcessAI() override;

        void Attack() override;

    public:
        void Die() override;

        int Attacked(MonsterObject *attacker, int damage, DefenceType type = DefenceType::ACAgility) override;

        int Attacked(PlayerObject *attacker, int damage, DefenceType type = DefenceType::ACAgility, bool damageWeapon = true) override;

        int Struck(int damage, DefenceType type = DefenceType::ACAgility) override;

        void ChangeHP(int amount) override;


        void Turn(MirDirection dir) override;

        bool Walk(MirDirection dir) override;

    protected:
        void ProcessRoam() override;

    public:
        Packet *GetInfo() override;

        void Show();
    };
}
